Skip to content

Conversation

@marian-ene-customsoft
Copy link

The changes would allow leveraging the {{ lang }} handlebar params to dynamically switch the current language on the BigCommerce StoreFront.

It would work verry well with a new handlebar for retrieving a query parameter as shown bellow
`'use strict';
const utils = require('handlebars-utils');
const common = require('./lib/common.js');

const factory = globals => {
return function(url, key) {
url = common.unwrapIfSafeString(globals.handlebars, url);
if (utils.isString(url)) {
const decodedURL = unescape(url);
const query = decodedURL.split('?');
if (query.length > 1) {
const params = new URLSearchParams(query[1]);
return params.get(key);
} else return 'en';
}
};
};

module.exports = [{
name: 'getURLQueryParam',
factory: factory,
}];`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant